package com.tl.web.controller.app;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.tl.common.annotation.Log;
import com.tl.common.core.controller.BaseController;
import com.tl.common.core.domain.AjaxResult;
import com.tl.common.enums.BusinessType;
import com.tl.app.domain.AppAccountAccess;
import com.tl.app.service.IAppAccountAccessService;
import com.tl.common.utils.poi.ExcelUtil;
import com.tl.common.core.page.TableDataInfo;

/**
 * 用户提现Controller
 * 
 * @author suhp
 * @date 2024-07-07
 */
@RestController
@RequestMapping("/app/access")
public class AppAccountAccessController extends BaseController
{
    @Autowired
    private IAppAccountAccessService appAccountAccessService;

    /**
     * 查询用户提现列表
     */
    @PreAuthorize("@ss.hasPermi('app:access:list')")
    @GetMapping("/list")
    public TableDataInfo list(AppAccountAccess appAccountAccess)
    {
        startPage();
        List<AppAccountAccess> list = appAccountAccessService.selectAppAccountAccessList(appAccountAccess);
        return getDataTable(list);
    }

    /**
     * 导出用户提现列表
     */
    @PreAuthorize("@ss.hasPermi('app:access:export')")
    @Log(title = "用户提现", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AppAccountAccess appAccountAccess)
    {
        List<AppAccountAccess> list = appAccountAccessService.selectAppAccountAccessList(appAccountAccess);
        ExcelUtil<AppAccountAccess> util = new ExcelUtil<AppAccountAccess>(AppAccountAccess.class);
        util.exportExcel(response, list, "用户提现数据");
    }

    /**
     * 获取用户提现详细信息
     */
    @PreAuthorize("@ss.hasPermi('app:access:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(appAccountAccessService.selectAppAccountAccessById(id));
    }

    /**
     * 新增用户提现
     */
    @PreAuthorize("@ss.hasPermi('app:access:add')")
    @Log(title = "用户提现", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AppAccountAccess appAccountAccess)
    {
        return toAjax(appAccountAccessService.insertAppAccountAccess(appAccountAccess));
    }

    /**
     * 修改用户提现
     */
    @PreAuthorize("@ss.hasPermi('app:access:edit')")
    @Log(title = "用户提现", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AppAccountAccess appAccountAccess)
    {
        return toAjax(appAccountAccessService.updateAppAccountAccess(appAccountAccess));
    }

    /**
     * 删除用户提现
     */
    @PreAuthorize("@ss.hasPermi('app:access:remove')")
    @Log(title = "用户提现", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(appAccountAccessService.deleteAppAccountAccessByIds(ids));
    }
}
